package lium.lbs.lbsim.adapter

import android.support.v4.content.ContextCompat
import android.text.TextUtils
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import com.buz.hjcdriver.bean.WalletRecordResultBean
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import lium.lbs.lbsim.R


class WalletAdapter : BaseQuickAdapter<WalletRecordResultBean, BaseViewHolder>(R.layout.item_wallet) {
    override fun convert(helper: BaseViewHolder?, item: WalletRecordResultBean?) {
        helper?.getView<TextView>(R.id.Ming)?.text = item?.Ming
        helper?.getView<TextView>(R.id.createDate)?.text = item?.createDate
        if (item?.flag.equals("3")) {
            helper?.getView<TextView>(R.id.price_satus)?.visibility = View.VISIBLE
            when (item?.status) {
                "0" -> {
                    helper?.getView<TextView>(R.id.price_satus)?.text = "申请中"

                }
                "1" -> {
                    helper?.getView<TextView>(R.id.price_satus)?.text = "申请成功"
                }
                "2" -> {
                    helper?.getView<TextView>(R.id.price_satus)?.text = "申请失败"
                }
            }

        } else {
            helper?.getView<TextView>(R.id.price_satus)?.visibility = View.GONE
        }

        helper?.getView<TextView>(R.id.price)?.text = item?.price
        if (TextUtils.equals("1", item?.flag)) {
            helper?.getView<TextView>(R.id.price)?.setTextColor(ContextCompat.getColor(mContext, R.color.color_3D79FE))
            helper?.getView<ImageView>(R.id.flag_image)?.setImageResource(R.drawable.icon_chongzhi)
        } else {
            helper?.getView<TextView>(R.id.price)?.setTextColor(ContextCompat.getColor(mContext, R.color.color_FF5252))
            helper?.getView<ImageView>(R.id.flag_image)?.setImageResource(R.drawable.icon_tixian)
        }
    }


}